The Logical Basis of Justice